import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:new_yuqib_app/yqbConfig/color_theme.dart';
import 'package:new_yuqib_app/yqbConfig/file_path.dart';
import 'package:new_yuqib_app/yqbConfig/yqb_base.dart';
import 'package:new_yuqib_app/yqbView/FeedbackView/view.dart';
import 'package:new_yuqib_app/yqbView/GyView/view.dart';
import 'package:new_yuqib_app/yqbView/LxView/view.dart';
import 'package:new_yuqib_app/yqbView/SetView/view.dart';

///自己
class MineView extends StatelessWidget {
  const MineView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorTheme.pageBackgroundColor,
      body: Column(
        children: [
          Stack(
            children: [
              Image.asset(FilePath.barBgPath, width: double.maxFinite, fit: BoxFit.fill),
              Positioned(
                bottom: 40,
                left: 0,
                right: 0,
                child: Row(
                  children: [
                    const SizedBox(width: 24),
                    const Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "133****9878",
                            style: TextStyle(color: ColorTheme.primaryTextColor, fontSize: 20, fontWeight: FontWeight.w500),
                          ),
                          SizedBox(height: 8),
                          Row(
                            children: [
                              Icon(Icons.lock_outline, size: 16, color: ColorTheme.primaryTextColor2),
                              SizedBox(width: 6),
                              Text(
                                "请妥善保管好您的个人信息",
                                style: TextStyle(color: ColorTheme.primaryTextColor2, fontSize: 12),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                    Container(
                      width: 80,
                      height: 80,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(40),
                        border: Border.all(width: 2, color: Colors.white),
                        image: const DecorationImage(
                          image: NetworkImage(testAvatarUrl),
                          fit: BoxFit.fill,
                        ),
                      ),
                    ),
                    const SizedBox(width: 28),
                  ],
                ),
              ),
            ],
          ),
          Container(
            width: double.maxFinite,
            height: 134,
            margin: const EdgeInsets.symmetric(horizontal: 12),
            padding: const EdgeInsets.symmetric(vertical: 16,horizontal: 12),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(4),
            ),
            child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [
              const Text(
                "业务流程",
                style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: ColorTheme.primaryTextColor),
              ),
              const SizedBox(height: 8),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  _buildItem(filePath: FilePath.yw1Path, subTitle: "提交资料"),
                  Image.asset(FilePath.iconRightPath,color: ColorTheme.secondaryTextColor,width: 18),
                  _buildItem(filePath: FilePath.yw2Path, subTitle: "制定方案"),
                  Image.asset(FilePath.iconRightPath,color: ColorTheme.secondaryTextColor,width: 18),
                  _buildItem(filePath: FilePath.yw3Path, subTitle: "签订合同"),
                  Image.asset(FilePath.iconRightPath,color: ColorTheme.secondaryTextColor,width: 18),
                  _buildItem(filePath: FilePath.yw4Path, subTitle: "结案交付"),
                ],
              ),
            ]),
          ),
          const SizedBox(height: 24),
          Container(
            color: Colors.white,
            child: Column(
              children: [
                menuItem(filePath: FilePath.menu1Path, title: "关于我们",onTap: (){
                  Get.to(const GyView());
                }),
                menuItem(filePath: FilePath.menu2Path, title: "意见反馈",onTap: (){
                  Get.to(const FeedbackPage());
                }),
                menuItem(filePath: FilePath.menu3Path, title: "系统设置",onTap: (){
                  Get.to(const SetPage());
                }),
                menuItem(filePath: FilePath.menu4Path, title: "联系我们",onTap: (){
                  Get.to(const LianXiView());
                }),
                // menuItem(filePath: FilePath.menu5Path, title: "在线客服"),
              ],
            ),
          ),
        ],
      ),
    );
  }
  //流程步骤
  Widget _buildItem({String filePath = "", String subTitle = ""}) {
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Image.asset(filePath, width: 44),
        const SizedBox(height: 6),
        Text(
          subTitle,
          style: const TextStyle(color: ColorTheme.primaryTextColor),
        ),
      ],
    );
  }

  //菜单item
  Widget menuItem({String filePath = "", String title = "",GestureTapCallback? onTap}) {
    return ListTile(
      leading: Image.asset(filePath, width: 24),
      title: Text(title),
      trailing: const Icon(Icons.arrow_forward_ios, size: 16),
      onTap: onTap,
    );
  }
}
